<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../../commons/taglib.jsp" %>
<!DOCTYPE html>
<html lang="zh-cn">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title>收费作废</title>
<link rel="stylesheet" href="${ctx}/static/css/admin.css">
<link rel="stylesheet" href="${ctx}/static/css/pintuer.css">
<script src="${ctx}/static/js/jquery.js"></script>
<script src="${ctx}/static/js/pintuer.js"></script>
</head>

<body>
		<div class="panel admin-panel">
			<div class="panel-head">
				<strong class="icon-reorder"> 收费作废</strong>
				<div style="float: right;">
					<button class="button border-main zf" type="button"> 确认作废</button>
		            <button class="button border-main" type="button"> 刷新</button>
				</div>
				<div style="clear: both;"></div>
			</div>
			<div class="padding border-bottom">
				<ul class="search" style="padding-left: 10px;">
					<li><input type="text" placeholder="就诊号码" class="input sj"
						style="width: 250px; height: 38px; line-height: 17px; display: inline-block" />
						<button onclick="fy()"  class="button border-main icon-search">搜索</button>
					</li>
					<li>&nbsp;&nbsp;&nbsp;&nbsp;
					<span class="s1"></span>&nbsp;&nbsp;
					<span class="s2"></span>&nbsp;&nbsp;
					<span class="s3"></span>
					</li>
				</ul>
			</div>
			<table class="table table-hover text-center yp_table">
				<tr>
					<th style="text-align: center;">名称</th>
					<th style="text-align: center;">用法</th>
					<th style="text-align: center;">用量</th>
					<th style="text-align: center;">总量</th>
				</tr>
				<volist name="list" id="vo">
				<tr class="tdt">
					<td class="td" style="text-align: left; padding-left: 29px;"></td>
					<td></td>
					<td></td>
					<td></td>
				</tr>
			</table>
			<div class="pagelist" style="display: none;">
				<input onclick="fy(1)" type="button" class="pags" id="" value="上一页" />	
			
				<label style="color: blueviolet;" type="button" class="pag" id="" >1</label>&nbsp;&nbsp;&nbsp;
			
				<label style="color: blueviolet;" type="button" class="pag2" id="">2</label>
			
				<input onclick="fy(2)" type="button" class="pagx" id="" value="下一页"/>
				
				总共<label id="lable" style="color: red;">1</label>页
			</div>
		</div>

	<script type="text/javascript">
		//搜索
		function fy(o){
			var pa;
			var sj = $(".sj").val();
			if(sj==""){
				alert("请输入正确的就诊号")
			}
			if(o==null){
				pa=1;
			}
			if(o==1){
				var p = $(".pag").html();
				if(p==1){
				}else{
					pa=parseInt(p)-1;
				}
			}
			if(o==2){
				var p = $(".pag").text();
				var o =$("#lable").html();
				if(p==o){
				}else{
					pa=parseInt(p)+1;
				}
			}
			console.log($(".sj").val());
			$.post('inserch',{
				id:$(".sj").val(),
				pageNaber:pa
			},function(e){
				$('.tdt').html("");
				$('.pagelist').show();
				console.log(e)
				var prccs = e.prccs;
				var presc = e.presc;

				if(prccs.length<1){
				console.log("药品")
				}else{
					$('#lable').text(e.pages);
					$('.pag').text(e.pageNmuber);
					$('.pag2').text(e.pageNmuber+1);
					if(e.pageNmuber==e.pages){
						$('.pag2').text(2);
					}
				}
				if(presc.length<1){
					console.log("项目")
				}else{
					$('#lable').text(e.pages);
					$('.pag').text(e.pageNmuber);
					$('.pag2').text(e.pageNmuber+1);
					if(e.pageNmuber==e.pages){
						$('.pag2').text(2);
					}
				}
				if(prccs.length>1&&presc.length>1){
					$('#lable').text(e.pages);
					$('.pag').text(e.pageNmuber);
					$('.pag2').text(e.pageNmuber+1);
					if(e.pageNmuber==e.pages){
						$('.pag2').text(2);
					}
				}
				for(var i=0; i<presc.length;i++){
		          	$(".yp_table").append("<tr class='tdt'>"+
		          		"<td>"+presc[i].d_name+"</td>"+
		          		"<td>"+presc[i].usagee+"</td>"+
		          		"<td>"+presc[i].dosage+"</td>"+
		          		"<td>"+presc[i].number+"</td>"+
		          		"</tr>"
		          		)
		          	$(".s1").text("费用类型: "+presc[i].category);
		          	$(".s2").text("病人姓名: "+presc[i].name);
		          	$(".s3").text("病人就诊号: "+sj);
		       	 }
				for(var i=0; i<prccs.length;i++){
		          	$(".yp_table").append("<tr class='tdt'>"+
		          		"<td>"+prccs[i].xd_name+"</td>"+
		          		"<td>"+"</td>"+
		          		"<td>"+"</td>"+
		          		"<td>"+prccs[i].x_number+"</td>"+
		          		"</tr>"
		          		)
		          	$(".s1").text("费用类型: "+prccs[i].category);
		          	$(".s2").text("病人姓名: "+prccs[i].name);
		          	$(".s3").text("病人就诊号: "+sj);
		       	 }
			});
		}
		
	$('.zf').click(function(){
		var sj = $(".sj").val();
		$.post("indeit",{
			id:sj
		},function(e){
			alert(e);
		});
	});

	</script>
</body>

</html>